<template>
	<!-- 增加Todox任务项 -->
	<div class="todoAdd">
		 <!-- <input type="text" v-model="item"/> -->
		 <!-- 绑定事件处理函数为传过来的函数，并传参 -->
		 <!-- <button @click="addItem(item)"> + </button> -->
		 
		 <van-field
		   v-model="item"
			 size="large"
		   center		   
		   label="任务项"
		   placeholder="请输入"
		 >
		   <template #button>
		     <van-button size="small" type="primary" @click="addItem(item)">增加</van-button>
		   </template>
		 </van-field>
		 
	</div>
</template>

<script>	
	export default {
		data(){
			return {
				item:"输入任务"
			}
		},
		methods:{
			addItem(item){
				//调用父组件的函数 传参 
				this.$parent.addItem(item);
			}
		}
	}
</script>

<style>
</style>
